﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="生成条形码、二维码.aspx.cs" Inherits="ProjectStudy.生成条形码barcode" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <script src="Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
    <script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            
            var lbBarcode = document.getElementById('<%=lbBarcode.ClientID %>');
            $("#btn").click(function () {
                var str = $("#" + '<%=TextBox1.ClientID %>').val();
                //alert(str);
                GenerateQRCode($("#img1"), str)
                lbBarcode.innerText = $("#" + '<%=TextBox1.ClientID %>').val();

            });

        });
        function GenerateQRCode(img, str) {
            img.attr("src", "../Ajax/二维码.ashx?str="+str);
//            $.ajax({
//                type: "POST",
//                url: "../Ajax/二维码.ashx",
//                datatype: "json",
//                data: { str: str },
//                success: function (data) {
//                    alert(data);
//                    if (data != "") {
//                        var s = data.replace('"', '');
//                        s = s.replace('"', '');
//                        
//                    }
//                }
//            });
        }

    </script>


</head>
<body>
    <form id="form1" runat="server">
    <input  type="button" id="btn" value="生成二维码和条形码" onclick="return btn_onclick()" />
    <br />
    <br />
     
    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
    <br />
    <br />
    <asp:Label ID="Label1" runat="server" Text="条形码"></asp:Label>
    <br />
    <br />
    <div style=" font-size:25pt;">
             <span style="font-family: '3 of 9 Barcode';">
                        <asp:Label ID="lbBarcode" runat="server"  Text=""></asp:Label></span>
            </div>

    <br />
    <br />

    <asp:Label ID="Label2" runat="server" Text="二维码"></asp:Label>
   
    <br />
    <br />
    
    <asp:Image ID="Image1" runat="server" Height="140px" Width="140px" />

    <img id="img1" />
    </form>
</body>
</html>
